package edu.uc.ui.ctrl25;

import java.util.Date;

import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import edu.uc.bean.Logger;
import edu.uc.service.LoggerService;

@Aspect
@Component
public class GetException {
	
	@Autowired
	private LoggerService loggerService;
	
    @AfterThrowing(throwing="ex", pointcut="execution(* edu.uc.service..*.*(..))")  
    public void doRecoverActions(Throwable ex) {
    	Logger logger = new Logger();
    	logger.setInsertData(new Date());
    	logger.setMessage(ex.getMessage());
    	logger.setType("doubleEE");
		System.out.println(logger);
		loggerService.loggerData(logger);
    }
}
